package com.entity.table;

import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;


/**
 * 收货地址表 表定义层。
 *
 * @author admin
 * @since 2025-11-21
 */
public class AddressTableDef extends TableDef {

    private static final long serialVersionUID = 1L;

    /**
     * 收货地址表
     */
    public static final AddressTableDef ADDRESS = new AddressTableDef();

    /**
     * 索引
     */
    public final QueryColumn ID = new QueryColumn(this, "id");

    /**
     * 会员手机号
     */
    public final QueryColumn PHONE = new QueryColumn(this, "phone");

    /**
     * 会员Id
     */
    public final QueryColumn USER_ID = new QueryColumn(this, "user_id");

    /**
     * 收货人
     */
    public final QueryColumn USER_NAME = new QueryColumn(this, "user_name");

    /**
     * 会员地址
     */
    public final QueryColumn USER_ADDRESS = new QueryColumn(this, "user_address");

    /**
     * 所有字段。
     */
    public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");

    /**
     * 默认字段，不包含逻辑删除或者 large 等字段。
     */
    public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, USER_NAME, PHONE, USER_ADDRESS, USER_ID};

    public AddressTableDef() {
        super("", "address");
    }

    private AddressTableDef(String schema, String name, String alisa) {
        super(schema, name, alisa);
    }

    public AddressTableDef as(String alias) {
        String key = getNameWithSchema() + "." + alias;
        return getCache(key, k -> new AddressTableDef("", "address", alias));
    }

}
